package com.study.spaoplog.config;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;

/**
 * @author study
 * @version 1.0
 * @date 2021/6/18 15:18
 */
@AllArgsConstructor
@NoArgsConstructor
public class Color implements InitializingBean, DisposableBean {
    private String color;

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
        System.out.println("Color.setColor");
    }

    /**
     * 在 bean 创建完成并且属性赋值完成，来执行初始化方法。
     */
    @PostConstruct
    public void post() {
        System.out.println("Color.PostConstruct");
    }

    public void init() {
        System.out.println("Color.init");
    }

    public void destory() {
        System.out.println("Color.destory");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("Color.DisposableBean.destroy");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("Color.afterPropertiesSet");
    }
}
